package com.hhkj.admin.course.service.base.impl;

import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.hhkj.admin.course.domain.Course;
import com.hhkj.admin.course.mapper.CourseMapper;
import com.hhkj.admin.course.model.dopo.CourseDo;
import com.hhkj.admin.course.model.dopo.CoursePo;
import com.hhkj.admin.course.service.base.CourseService;
import com.ruoyi.common.base.biz.service.base.BaseServiceImpl;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

/**
 * 课程信息Service业务层处理
 *
 * @author ruoyi
 * @since 2023-05-09
 */
@Service
public class CourseServiceImpl
        extends BaseServiceImpl<Course, CourseDo, CoursePo, CourseMapper>
        implements CourseService
{
    @Override
    public List<Course> listByIdList(List<Long> idList, Integer disableFlag) {
        if (ObjectUtil.isEmpty(idList)) {
            return new ArrayList<>();
        }
        LambdaQueryWrapper<Course> queryWrapper = new LambdaQueryWrapper<Course>()
                .in(Course::getId, idList)
                .eq(Course::getDisableFlag, disableFlag);
        return list(queryWrapper);
    }

    @Override
    public List<CoursePo> listLevelNumThirdPoByDo(Course conditionDo)
    {
        return this.getBaseMapper().listLevelNumThirdPoByDo(conditionDo);
    }

    @Override
    public CoursePo getLevelNumThirdPoById(Long id)
    {
        return this.getBaseMapper().getLevelNumThirdPoById(id);
    }

    @Override
    public List<CoursePo> listTodayBankAmountByIdList(List<Long> idList)
    {
        return this.getBaseMapper().listTodayBankAmountPoByIdList(idList);
    }

    @Override
    public CoursePo getTodayBankAmountById(Long id)
    {
        return this.getBaseMapper().getTodayBankAmountPoById(id);
    }

    @Override
    public List<Course> listByNameList(List<String> courseNameList, Integer disableFlag) {
        if (ObjectUtil.isEmpty(courseNameList)) {
            return new ArrayList<>();
        }
        LambdaQueryWrapper<Course> queryWrapper = new LambdaQueryWrapper<Course>()
                .in(Course::getName, courseNameList)
                .eq(ObjectUtil.isNotEmpty(disableFlag), Course::getDisableFlag, disableFlag);
        return list(queryWrapper);
    }
}
